<!--
 * @Author: yuqy
 * @Date: 2023-04-10 19:26:39
 * @LastEditors: yuqy
 * @LastEditTime: 2023-10-23 13:57:39
 * @Descripttion: -
-->

<template>
  <div class="contain_wrap">
    <WhiteBoardWrap
      :appIdentifier="appIdentifier"
      :uid="uid"
      :uuid="uuid"
      :roomToken="roomToken"
      :nickName="nickName"
      v-if="roomToken"
    />
    <!-- <WhiteBoardSelf /> -->
    <!-- 展示退出按钮和最小化 -->
    <div class="exit_wrap">
      <van-switch
        :loading="switchLoading"
        :model-value="isAllWrite"
        size="24px"
        active-color="#FE6400"
        style="border: 1px solid #fff;"
        @click="isNoWrite()"
      />
      <Icon v-if="!APP_IS_Web" type="md-remove" class="icon_min" style="margin-right: 10px;" @click="closeFn(1)"/>
      <Icon type="md-close" class="close" @click="closeFn(2)"/>
    </div>
  </div>
</template>
<script >
import { Icon } from "view-ui-plus";
import mixin from "@/mixins/whiteboard.js";
import "vant/lib/switch/style";
export default {
  name: "WhiteBoard",
  setup() {},
  async created() {
    // 默认是主讲的
    this.uid = '2' + this.uid_;
    this.code = this.$route.query.code;
    if (this.code) {
      this.createRoom();
    }
  },
  components: {
    Icon
  },
  mixins: [mixin],
  data() {
    return {
      code: null,
      switchLoading: false,
      isAllWrite: true, // 默认允许所有人书写
      isSelfClose: false // 是否已经自定义关闭
    };
  },
  unmounted () {
    if (!this.isSelfClose) {
      this.closeFn(2);
    }
  },
  methods: { }
};
</script>
<style scoped lang='less'>
.exit_wrap {
  display: flex;
  align-items: center;
  position: fixed;
  z-index: 9999;
  top: 10px;
  right: 20px;
  color: #888;
  font-size: 36px;
  overflow: hidden;
  div {
    margin-right: 10px;
  }
  .icon_min {
    &:hover {
      color: #000;
      text-shadow: 0px 0px 2px #fff;
      transform: scale(1.25);
    }
  }
  .close {
    vertical-align: 0;
    &:hover {
      text-shadow: 0px 0px 5px #fff;
      color: #fff;
      transition: all 0.85s;
      transform: rotateZ(360deg) scale(1.25);
      color: #000;
      transform-origin: 50% 50%;
    }
  }
}
</style>
